/**
 * Copyright (c) 2013-Now http://jeesite.com All rights reserved.
 */
package com.jeesite.modules.storage.service;


import com.jeesite.common.service.CrudService;
import com.jeesite.modules.storage.dao.TransGoodsDao;
import com.jeesite.modules.storage.entity.ActivityGoods;
import com.jeesite.modules.storage.entity.TransGoods;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * 转发商品Service
 */
@Service
@Transactional(readOnly=true)
public class TransGoodsService extends CrudService<TransGoodsDao, TransGoods> {

	/**
	 * 转发
	 * @param memberId 会员Id
	 * @param transActivityId 转发活动Id
	 * @param goods 商品
	 * @param method 方式【单图、多图】
	 * @param isBuy 是否购买
	 * @param addPrice 加价
	 */
	@Transactional(readOnly=false)
	public String trans(String memberId, String transActivityId, ActivityGoods goods, String method, Boolean isBuy, Double addPrice){
		TransGoods transGoods = new TransGoods();
		transGoods.setMemberId(memberId);
		transGoods.setTransActivityId(transActivityId);
		transGoods.setActivityId(goods.getActivityId());
		transGoods.setBrandId(goods.getBrandId());
		transGoods.setCateId(goods.getCateId());
		transGoods.setCategory(goods.getCategory());
		transGoods.setGoodsId(goods.getId());
		transGoods.setThumbnail(goods.getThumbnail());
		transGoods.setPicture(goods.getPicture());
		transGoods.setPlatform(goods.getPlatform());
		transGoods.setCode(goods.getCode());
		transGoods.setName(goods.getName());
		transGoods.setMaterial(goods.getMaterial());
		transGoods.setPlace(goods.getPlace());
		transGoods.setYear(goods.getYear());
		transGoods.setSeason(goods.getSeason());
		transGoods.setPrice(goods.getPrice());
		transGoods.setVipPrice(goods.getVipPrice());
		transGoods.setMemberPrice(goods.getMemberPrice());
		transGoods.setAgentPrice(goods.getAgentPrice());
		transGoods.setShareSinglePic(goods.getShareSinglePic());
		transGoods.setShareSingleBuyPic(goods.getShareSingleBuyPic());
		transGoods.setShareMultiplePic(goods.getShareMultiplePic());
		transGoods.setShareMultipleBuyPic(goods.getShareMultipleBuyPic());
		transGoods.setMethod(method);
		transGoods.setIsBuy(isBuy);
		transGoods.setAddPrice(addPrice);
		super.save(transGoods);
		return transGoods.getId();
	}
}
